<template>
    <div class="container">
        <el-row type="flex" justify="space-between">
            <!-- 订单表单 -->
            <div class="main">
                <OrderForm @priceEvent="setTotalPrice" :data="inforData"></OrderForm>
            </div>
            <!-- 侧边栏 -->
            <div class="aside">
                <OrderAside :allPrice="totalPrice" :data="inforData"></OrderAside>    
            </div>
        </el-row>
    </div>
</template>

<script>
import OrderForm from '@/components/air/orderForm.vue'
import OrderAside from '@/components/air/orderAside.vue'
export default {
    components: {OrderForm,OrderAside},
    data(){
        return {
            // 机票信息
            inforData: {
                insurances: [], // 保险信息
                seat_infos: {} // 添加座位信息
            },
            totalPrice: 0
        }
    },
    mounted(){
        // 获取机票信息
        this.getAirInfo()
    },
    methods:{
        // 获取机票信息
        getAirInfo(){
            this.$axios({
                url: '/airs/'+ this.$route.query.id,
                params: {
                    seat_xid: this.$route.query.seat_xid
                }
            }).then(res=>{
                // console.log(38,res);
                this.inforData = res.data
            })
        },
        // 获取总价格
        setTotalPrice(price){
            console.log(price);
            this.totalPrice = price
        }
    }
}
</script>

<style lang="less" scoped>
    .container{
        width:1000px;
        margin:20px auto;
    }
    
    /*aside*/
    .aside{
        width: 350px;
        height: fit-content;
        border:1px #ddd solid;
    }
</style>